<template>
  <div>
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span>时段雨量</span>
      </div>
      <div class="body">
        <el-table v-loading="loading" size="medium " :data="tableData" border style="width: 100%">
          <!-- <el-table-column prop="YMDHM" label="日期" width="400"></el-table-column> -->
          <el-table-column prop="STNM" label="站点名称" width="120"></el-table-column>
          <el-table-column prop="SR" label="3小时雨量" width="120"></el-table-column>
          <el-table-column prop="SR1" label="6小时雨量" width="120"></el-table-column>
          <el-table-column prop="SR2" label="12小时雨量" width="150"></el-table-column>
        </el-table>
        <div class="block">
          <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
            :page-size="param.pageSize" layout="prev, pager, next" :total=" total ">
          </el-pagination>
        </div>
      </div>
    </el-card>
  </div>
</template>

<script>
export default {
  data () {
    return {
      loading: true,
      param: {
        pageSize: 15,
        page: 1
      },
      tableData: [],
      total: 0,
      currentPage: 1
    }
  },
  created () {
    this.findData()
  },
  methods: {
    findData (param) {
      this.$postJSON('/ssjc/Rain/rainLiveBySr?', param).then(result => {
        this.currentPage = result.data.currPage
        this.tableData = result.data.result
        this.total = result.data.total
        console.log(result.data.result)
      })
    },
    handleSizeChange (val) {
      this.param.pageSize = val
      this.findData(this.param)
    },
    handleCurrentChange (val) {
      this.param.page = val
      this.findData(this.param)
    }
  }
}
</script>

<style scoped>
.text {
  font-size: 14px;
}

.item {
  margin-bottom: 18px;
}

.box-card {
  margin: 10px;
  width: 98%;
}

.block {
  margin-top: 8px;
  margin-left: 50px;
}
/*tbody tr样式*/
.body>>>.el-table tr{
  background-color: #fff;
}
</style>
